package com.analyse.stock.enums;

import org.apache.commons.lang3.StringUtils;

public enum StrategyEnum {
    SMALL_CAP_STRATEGY("SMALL_CAP_STRATEGY","小市值公司策略0-200亿",StrategyCategoryEnum.ANALYSE),
    MID_CAP_STRATEGY("MID_CAP_STRATEGY","中市值公司策略200-500亿",StrategyCategoryEnum.ANALYSE),
    PICK_STOCK("PICK_STOCK","选股分析策略A股市场",StrategyCategoryEnum.ANALYSE),

    T1_TRADING_STRATEGY("T1_TRADING_STRATEGY","T+1交易策略A股市场",StrategyCategoryEnum.TRADING),
    TOP_RANK_TRADING("TOP_RANK_TRADING","打榜策略",StrategyCategoryEnum.TRADING)
    ;
    StrategyEnum( String code,String desc, StrategyCategoryEnum categoryEnum) {
        this.code = code;
        this.desc = desc;
        this.categoryEnum = categoryEnum;
    }

    private String code;
    /**
     * 描述信息
     */
    private final String desc;
    /**
     * 所属指标模块
     */
    private final StrategyCategoryEnum categoryEnum;

    public String getCode() {
        return this.code;
    }
    public String getDesc() {
        return  this.desc;
    }
    public StrategyCategoryEnum getCategoryEnum() {
        return  this.categoryEnum;
    }

    public static StrategyEnum getByCode(String code){
        if(StringUtils.isBlank(code)) {
            return null;
        }
        for (StrategyEnum anEnum : values()) {
            if (anEnum.code.contains(code.toUpperCase())){
                return anEnum;
            }
        }
        return null;
    }
}
